package com.yanqu.road.logic.config;

import com.yanqu.road.logic.bussiness.config.ConfigBussiness;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.HashMap;

public class ServerConfig {

    private static final Logger logger = LogManager.getLogger(ServerConfig.class.getName());

    @ConfigPropertyAnnotation(key = "BEAUTY_UNDRESS",description = "美女脱衣功能开关（0：不脱；1：脱），默认开",type = Integer.class,defaultValue = "1")
    public static Integer BEAUTY_UNDRESS;

    @ConfigPropertyAnnotation(key = "RECHARGE_DEBUG_MODE",description = "充值调试模式（0：关闭；1：开启），默认关闭",type = Integer.class,defaultValue = "0")
    public static int RECHARGE_DEBUG_MODE;

    @ConfigPropertyAnnotation(key = "ACTIVITY_AUTO_SEND_RANK_REWARD",description = "活动冲榜奖励自动发放（0：关闭；1：开启），默认开启",type = Integer.class,defaultValue = "1")
    public static int ACTIVITY_AUTO_SEND_RANK_REWARD;

    @ConfigPropertyAnnotation(key = "PRIVILEGE_CARD_AUTO_SEND_REWARD",description = "特权卡补发未领取奖励（0：关闭；1：开启），默认开启",type = Integer.class,defaultValue = "1")
    public static int PRIVILEGE_CARD_AUTO_SEND_REWARD;

    @ConfigPropertyAnnotation(key = "ANALYZE_USER_LOG",description = "玩家分析日志开关（0：关闭；1：开启），默认开启",type = Integer.class,defaultValue = "1")
    public static int ANALYZE_USER_LOG;

    @ConfigPropertyAnnotation(key = "PLATFORM_FORBIDDEN_WORD",description = "平台敏感词开关（0：关闭；1：开启），默认开启",type = Integer.class,defaultValue = "1")
    public static int PLATFORM_FORBIDDEN_WORD;

    @ConfigPropertyAnnotation(key = "CHAT_FORBIDDEN_WORD_SHOW",description = "聊天敏感词提示，默认关闭",type = Integer.class,defaultValue = "0")
    public static int CHAT_FORBIDDEN_WORD_SHOW;

    @ConfigPropertyAnnotation(key = "GOLD_TOKEN_BUY_SWITCH",description = "代币购买开关，0：关闭；1：打开（默认打开）",type = Integer.class,defaultValue = "1")
    public static int GOLD_TOKEN_BUY_SWITCH;

    @ConfigPropertyAnnotation(key = "OVERSEAS_PLATFORM_FORBIDDEN_WORD",description = "海外平台敏感词开关（0：关闭；1：开启），默认开启",type = Integer.class,defaultValue = "1")
    public static int OVERSEAS_PLATFORM_FORBIDDEN_WORD;

    public static void reloadServerConfig(long serverId) {
        logger.info("reload server config! serverId : {}" , serverId);
        HashMap<String, String> dataMap = ConfigBussiness.getServerConfig(serverId);
        TempConfig.Load(ServerConfig.class, dataMap);
    }

    public static void save() {
        logger.info("saving channel config into db!");
    }

}
